@if($leftMenuData)
<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="sidebar-collapse">
        <ul class="nav metismenu" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element col-xs-1">
                    <a class="dropdown-toggle" href="#">
                        <span class="font-bold">{{Auth::guard('admin')->user()->username}}</span>
                        <span class="float-right" id="logout" data-url="{{route('logout')}}">登出</span>
                    </a>
                </div>
            </li>
            @foreach($leftMenuData as $key1=>$menuData)
                <li @if($menuData['active']) class="active" @endif>
                    <a href="{{$menuData['url']}}">
                        <i class="fa {{$menuData['ico']}}"></i>
                        <span class="nav-label">{{$menuData['name']}}</span>
                        @if(isset($menuData['child']))
                            <span class="fa arrow"></span>
                        @endif
                    </a>
                    @if(isset($menuData['child']))
                        <ul class="nav nav-second-level collapse">
                            @foreach($menuData['child'] as $key2=>$md)
                                <li class="{{ $md['active'] ? 'active' : ''}}">
                                    <a href="{{$md['url']}}">
                                        {{$md['name']}}
                                        @if(isset($md['child']))
                                            <span class="fa arrow"></span>
                                        @endif
                                    </a>
                                    @if(isset($md['child']))
                                        <ul class="nav nav-third-level collapse" style="">
                                            @foreach($md['child'] as $key3=>$md3)
                                                <li class="{{ $md3['active'] ? 'active' : ''}}">
                                                    <a href="{{$md3['url']}}">
                                                        {{$md3['name']}}
                                                    </a>
                                                </li>
                                            @endforeach
                                        </ul>
                                    @endif
                                </li>
                            @endforeach
                        </ul>
                    @endif
                </li>
            @endforeach
        </ul>
    </div>
</nav>
@endif
{{--右侧二级菜单--}}
@if($leftSubMenuData && $leftSubMenuData['groups'])
    <nav class="navbar-static-side sub-navbar-default">
        <ul class="sub-navbar-ul">
            <li class="sub-menu-title">
                <a>
                    {{$leftSubMenuData['title']}}
                </a>
            </li>
            <li class="groups">
                <ul class="sub-navbar-group-ul">
                    @foreach((array)$leftSubMenuData['groups'] as $group)
                        <li class="sub-menu-group-title">
                            {{$group['title']}}
                        </li>
                        @foreach($group['item'] as $item)
                            <li @if($item['active']) class="active" @endif>
                                <a href="{{route($item['url'])}}">
                                    <i class="fa {{$item['icon']}}"></i>
                                    <span class="nav-label">{{$item['title']}}</span>
                                </a>
                            </li>
                        @endforeach
                    @endforeach
                </ul>
            </li>
        </ul>
    </nav>
@endif
{{--/右侧二级菜单--}}
<script>
    $(function() {
        layui.use('layer', function(){
            var layer = layui.layer;
            $('#logout').on('click', function () {
                var that = this
                layer.confirm('确认退出？', {
                    btn: ['确定','取消']
                    ,btn1: function(index, layero){
                        window.location.href = $(that).data('url')
                        layer.closeAll()
                    }
                })
            })

        });
    });
</script>
